package com.gxa.controller;

import com.gxa.common.Constants;
import com.gxa.common.ResponseData;
import com.gxa.service.ResignationService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * User: tx
 * Date: 2020/11/03 16:36
 * Description:在职离职
 * Version: V1.0
 */
@RestController
@Api(value = "更改在职离职",tags = "在职离职设置")
@RequestMapping(value = "resignation")
public class ResignationController {

    @Autowired
    private ResponseData responseData;
    @Autowired
    public ResignationService resignationservice;

    @GetMapping("/updateResignation")
    @ApiOperation(value = "更改在职离职接口", notes = "根据信息更新在职离职接口", httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "更新成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "更新失败")
    })
    public ResponseData updateResignation(@ApiParam(name = "employeeId",value = "员工id") int employeeId){
        int result = resignationservice.updateResignation(employeeId);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("更新成功");
            responseData.setData(null);
        }
        return responseData;
    }
}
